Skip to content

Conversation

@garyrussell
Copy link
Contributor

JIRA: https://jira.spring.io/browse/INT-4231

For FileWritingMessageHandler and (S)FTP outbound gateways, support
FileExistsMode.REPLACE_IF_MODIFIED to allow overwriting an existing file if
the source file modified time is different to the existing file.

JIRA: https://jira.spring.io/browse/INT-4231

For `FileWritingMessageHandler` and (S)FTP outbound gateways, support
`FileExistsMode.REPLACE_IF_MODIFIED` to allow overwriting an existing file if
the source file modified time is different to the existing file.
@artembilan
Copy link
Member

@artembilan
Copy link
Member

There are a couple errors with JavaDocs according Travis:

:spring-integration-file:javadoc/home/travis/build/spring-projects/spring-integration/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java:839: error: @param name not found

	 * @param lsFirst true to execute an 'ls' command first.

	          ^

/home/travis/build/spring-projects/spring-integration/spring-integration-file/src/main/java/org/springframework/integration/file/remote/gateway/AbstractRemoteFileOutboundGateway.java:843: warning: no @param for fileInfoParam

	protected File get(Message<?> message, Session<F> session, String remoteDir, String remoteFilePath,

	               ^

Assert.isTrue(!FileExistsMode.APPEND.equals(mode) || !this.useTemporaryFileName,
"Cannot append when using a temporary file name");
Assert.isTrue(!FileExistsMode.REPLACE_IF_MODIFIED.equals(mode),
"FilExistsMode.REPLACE_IF_DIFFERENT can only be used for local files");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overdid. There is no such a constant FilExistsMode.REPLACE_IF_DIFFERENT 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doh - this was a last-minute change.

<xsd:documentation><![CDATA[
If the local file already exists, it will be overwritten only
if the last modified timestamp does not match the source
time stamp. Only applies to local files.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think no reason in the whitespace, like you don't have it in other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?? please explain further.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other places it is like timestamp, but here it is some how like time stamp.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah - yes - in future it would be clearer if you said s/time stamp/timestamp/, or explicitly "space between time and stamp" rather than a general statement 😄

command="mget"
expression="payload"
command-options="-R -P"
mode="REPLACE_IF_DIFFERENT"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

??? REPLACE_IF_MODIFIED ?
Otherwise:

Caused by: java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'org.springframework.integration.file.support.FileExistsMode' for property 'fileExistsMode': no matching editors or conversion strategy found
	at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:294)
	at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:572)
	... 54 more

command="mget"
expression="payload"
command-options="-R -P"
mode="REPLACE_IF_DIFFERENT"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DITTO

The following options exist:

* REPLACE (Default)
* REPLACE_IF_DIFFERENT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DITTO

The flush predicates for the `FileWritingMessageHandler` now have an additional parameter.
See <<file-flushing>> for more information.

The file outbound channel adapter (`FileWritingMessageHandler`) now supports the `REPLACE_IF_DIFFERENT` `FileExistsMode`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DITTO

@artembilan
Copy link
Member

Merged as 2d4a7cf

@artembilan artembilan closed this Feb 22, 2017
@garyrussell garyrussell deleted the INT-4231 branch March 17, 2017 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants